package com.xiangff.demo.nowebxml.app;

import com.xiangff.demo.nowebxml.config.RootConfig;
import com.xiangff.demo.nowebxml.config.WebConfig;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;

/**
 *  1. Servlet3.0及之后才支持的  Tomcat7 及 +
 *  2. 本类会被自动加载,负责应用程序中servlet上下文中DispatcherServlet和Spring其他上下文的配置
 *          <p>
 *              1.Servlet 3.0 环境下，Servlet 容器会在 classpath 下搜索实现了ServletContainerInitializer 接口的任何类
 *              2.Spring 实现类 SpringServletContainerInitializer
 *                             spring3.2 引入了WebApplicationInitializer - > AbstractAnnotationConfigDispatcherServletInitializer(本类)
 *          </p>
 */
public class NoxmlAppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
    @Override
    protected Class<?>[] getRootConfigClasses() {
        return new Class[]{RootConfig.class};
    }

    @Override
    protected Class<?>[] getServletConfigClasses() {
        return new Class[]{WebConfig.class};
    }

    @Override
    protected String[] getServletMappings() {
        return new String[]{"/"};
    }
}
